cssnode: Don't leak the style cache on destruction
authorBenjamin Otte <otte@redhat.com>
Mon, 18 Jan 2016 17:05:53 +0000 (18:05 +0100)
committerBenjamin Otte <otte@redhat.com>
Mon, 18 Jan 2016 17:06:41 +0000 (18:06 +0100)
gtk/gtkcssnode.c

index aac0bb3d9d4ce7f88086bb66f321f7930991a4b3..0a4c510a4de6a08d56a7c558948d7c62263ddd06 100644 (file)
@@ -236,6 +236,8 @@ gtk_css_node_dispose (GObject *object)
     }
 
   gtk_css_node_set_invalid (cssnode, FALSE);
+  
+  g_clear_pointer (&cssnode->cache, gtk_css_node_style_cache_unref);
 
   G_OBJECT_CLASS (gtk_css_node_parent_class)->dispose (object);
 }
@@ -314,6 +316,7 @@ lookup_in_global_parent_cache (GtkCssNode                  *node,
   if (parent->cache == NULL)
     return NULL;
 
+  g_assert (node->cache == NULL);
   node->cache = gtk_css_node_style_cache_lookup (parent->cache,
                                                  (GtkCssNodeDeclaration *) decl,
                                                  gtk_css_node_is_first_child (node),